package ORDER;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JFrame;

import TOOLS.SQLtool;
import TOOLS.errCodeManagement;

public class test006_getOrderBom {

	public static void main(String[] args) {
		SQLtool sql=new SQLtool();
		String IPaddr="192.168.1.1";
		try {
			InetAddress addr = InetAddress.getLocalHost();
			IPaddr=addr.getHostAddress();
		} catch (UnknownHostException e1) {
			;
		}
		sql.config(IPaddr, "AKS2019", "sa", "123456");
//		sql.config("10.130.0.231", "Smes", "sa", "led-00");
//		sql.config("10.130.1.15", "Smes", "root", "led-123@");
		sql.config("192.168.0.39", "AKS2019", "sa", "abcd1234!");
		try {
			sql.connect();
			new JFrame().setVisible(true);
			c_order c=new c_order(sql);
			System.out.println(GetTimestamp());
			m_orderBOM b=c.getOrderBOM("PN0011097359", 1);
//			String bin=c.getPanelOrderBIN("PN0011097359");
//			System.out.println(bin);
			System.out.println(GetTimestamp());
			System.exit(0);
		} catch (Exception e) {
			String str=errCodeManagement.getErrText(e.getMessage());
			System.out.println(str);
			System.exit(0);
		}
	}
	public static String GetTimestamp(){
    	//"2017-12-10 15:52:10";
    	String timestamp=new String();
    	SimpleDateFormat t = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
    	timestamp=""+t.format(new Date());
    	return timestamp;
    }
}
